package com.zxy.ziems.server.device.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zxy.ziems.server.device.pojo.entity.DeviceEntity;
import com.zxy.ziems.server.device.pojo.param.DeviceQueryParam;
import com.zxy.ziems.server.device.pojo.vo.SceneDeviceAlarmCountVO;
import com.zxy.ziems.server.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 设备抽象
 *
 * @author chdzq
 * @create 2023/3/22
 */
@Mapper
public interface DeviceMapper extends BaseMapperX<DeviceEntity> {

    /**
     * 分页查询
     *
     * @param page
     * @param param
     * @return
     */
    IPage<DeviceEntity> queryPageList(@Param("page") IPage<DeviceEntity> page, @Param("param") DeviceQueryParam param);


    /**
     * 查询某楼层，某类型设备
     *
     * @param typeCodes
     * @param sceneId
     * @return
     */
    List<DeviceEntity> queryAddressAndAlarm(@Param("typeCodes") List<String> typeCodes, @Param("sceneId") String sceneId);

    List<SceneDeviceAlarmCountVO> countDeviceAlarm(@Param("deviceTypeCodes") List<String> deviceTypeCodes);

    List<DeviceEntity> listByIdListAndDelete(@Param("ids") Set<String> ids);

    List<DeviceEntity> selectListByCodeListAndDelete(@Param("codes") Set<String> deviceCodeSet);

    // 批量查询设备id
    List<String> batchGetDeviceId(@Param("deviceCodes") List<String> deviceCodes);

    List<String> selectDeviceIdByCodeOrName(@Param("code") String code, @Param("name") String name);
}
